<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>添加学生信息</title>
    <script src="/js/jquery-3.3.1.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript">
        $(function(){
            $("#form").submit(function () {
                $.post("/student/add",$(this).serialize(),function(data){
                    if (data){
                        if(confirm("添加成功！返回首页")){
                            location.href = "/index.html";
                        }
                    } else{
                        alert("添加失败");
                    }
                });
                return false;
            });
        });
    </script>
</head>
<body>
<form id="form">
    <table>
        <tr>
            <td> 姓名:</td>
            <td><input name="name" type="text"></td>
            <td></td>
        </tr>
        <tr>
            <td> 密码:</td>
            <td><input name="password" type="password"></td>
            <td></td>
        </tr>
        <tr>
            <td> 年龄:</td>
            <td><input name="age" type="text"></td>
            <td></td>
        </tr>
        <tr>
            <td> 性别:</td>
            <td><input name="sex" type="text"></td>
            <td></td>
        </tr>
        <tr>
            <td> 生日:</td>
            <td><input name="birthday" type="date"
                       value=<fmt:formatDate value='' pattern='yyyy-MM-dd' />
            </td>
            <td></td>
        </tr>
        <tr>
            <td> 地址:</td>
            <td><input name="address" type="text" value=""></td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td><input type="submit" value="添加"></td>
            <td></td>
        </tr>
    </table>
</form>
</body>
</html>